package com.ruoyi.tccs.tccs_blood_estimate.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.tccs.tccs_blood_estimate.domain.TccsBloodEstimate;
import com.ruoyi.tccs.tccs_blood_estimate.service.ITccsBloodEstimateService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 血流动/信号参考Controller
 *
 * @author RenZhengYang
 * @date 2024-04-06
 */
@RestController
@RequestMapping("/tccs/tccs_blood_estimate")
public class TccsBloodEstimateController extends BaseController
{
    @Autowired
    private ITccsBloodEstimateService tccsBloodEstimateService;

    /**
     * 查询血流动/信号参考列表
     */
    @PreAuthorize("@ss.hasPermi('tccs:tccs_blood_estimate:list')")
    @GetMapping("/list")
    public TableDataInfo list(TccsBloodEstimate tccsBloodEstimate)
    {
        startPage();
        List<TccsBloodEstimate> list = tccsBloodEstimateService.selectTccsBloodEstimateList(tccsBloodEstimate);
        return getDataTable(list);
    }

    /**
     * 导出血流动/信号参考列表
     */
    @PreAuthorize("@ss.hasPermi('tccs:tccs_blood_estimate:export')")
    @Log(title = "血流动/信号参考", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TccsBloodEstimate tccsBloodEstimate)
    {
        List<TccsBloodEstimate> list = tccsBloodEstimateService.selectTccsBloodEstimateList(tccsBloodEstimate);
        ExcelUtil<TccsBloodEstimate> util = new ExcelUtil<TccsBloodEstimate>(TccsBloodEstimate.class);
        util.exportExcel(response, list, "血流动/信号参考数据");
    }

    /**
     * 获取血流动/信号参考详细信息
     */
    @PreAuthorize("@ss.hasPermi('tccs:tccs_blood_estimate:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tccsBloodEstimateService.selectTccsBloodEstimateById(id));
    }

    /**
     * 新增血流动/信号参考
     */
    @PreAuthorize("@ss.hasPermi('tccs:tccs_blood_estimate:add')")
    @Log(title = "血流动/信号参考", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TccsBloodEstimate tccsBloodEstimate)
    {
        tccsBloodEstimate.setCreateBy(getUsername());
        return toAjax(tccsBloodEstimateService.insertTccsBloodEstimate(tccsBloodEstimate));
    }

    /**
     * 修改血流动/信号参考
     */
    @PreAuthorize("@ss.hasPermi('tccs:tccs_blood_estimate:edit')")
    @Log(title = "血流动/信号参考", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TccsBloodEstimate tccsBloodEstimate)
    {
        tccsBloodEstimate.setUpdateBy(getUsername());
        return toAjax(tccsBloodEstimateService.updateTccsBloodEstimate(tccsBloodEstimate));
    }

    /**
     * 删除血流动/信号参考
     */
    @PreAuthorize("@ss.hasPermi('tccs:tccs_blood_estimate:remove')")
    @Log(title = "血流动/信号参考", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tccsBloodEstimateService.deleteTccsBloodEstimateByIds(ids));
    }
}
